package com.bdqn.ch06.sl;

import org.apache.log4j.Logger;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;

@Aspect
public class ErrorLogger {
    private static final Logger log = Logger.getLogger(ErrorLogger.class);
    @AfterThrowing(pointcut = "execution(* com.bdqn.ch05.sl.sl1.service.UserService.*(..))",throwing = "e")
    public void afterThrowing(JoinPoint jp,RuntimeException e){
        log.debug(jp.getSignature().getName()+"方法发生异常:"+e);
    }
}
